Skip to content

Conversation

Stradi
Copy link
Contributor

@Stradi Stradi commented Apr 22, 2025

This PR updates following:

  1. We are not using --experimental-include-runtime anymore, since Wrangler now generates runtime types too. When running wrangler types with the flag above, CLI shows an error and stops generating types;
✘ [ERROR] You no longer need to use --experimental-include-runtime.

  `wrangler types` will now generate runtime types in the same file as the Env types.
  You should delete the old runtime types file, and remove it from your tsconfig.json.
  Then rerun `wrangler types`.
  1. Include --env-interface flag. This ensures that getCloudflareContext() returns correct binding types. OpenNext has CloudflareEnv interface but by default Wrangler saves bindings in Env interface. This causes CloudflareEnv (used by OpenNext) not have the correct types for bindings.

Some issues I've found about this:

@Stradi Stradi requested review from a team and james-elicx as code owners April 22, 2025 16:43
Copy link
Collaborator

@james-elicx james-elicx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@james-elicx james-elicx merged commit fbf8c17 into opennextjs:main Apr 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Bindings types aren't being populated despite running npx wrangler types

2 participants